#ifndef __GRAPHICS_H__
#define __GRAPHICS_H__

#include "./bitmap.h"
#include <stack>

class SkPath;
class SkPaint;
class SkCanvas;

namespace MiniUI
{

class Graphics
{
public:
    Graphics();
    ~Graphics();
    //Operation
    void Rebuild(Bitmap* bitmap);
    void Clear();
    void Save();
    void SaveMatrix();
    void Restore();
    //Matrix
    void Translate(int x, int y);
    //Properties
    void SetRectClip(const Type::MiniRect& rcClip, bool bIntersect);
    void SetCircleClip(const Type::MiniRect& rcClip, bool bIntersect);
    void SetDrawColor(const Type::MiniARGB& color);
    void SetAlpha(byte alpha);
	void SetStrokeWidth(int width);
    void SetTextSize(int size);
    void SetFontStyle(uint style);
    void SetFontFaceName(const char* szFaceName);
    //Draw
    void DrawText(const std::string& text, const Type::MiniRect& rect, uint align, bool bMultiline);
    void DrawBitmap(Bitmap* pBitmap, Type::MiniRect* rcSrc, const Type::MiniRect& rcDst);
    void DrawRectangle(const Type::MiniRect& rect);
    void DrawCircle(const Type::MiniPoint& pt, uint radius);
	void DrawLine(const Type::MiniPoint& ptSrc, const Type::MiniPoint& ptDst);
private:
    SkCanvas* m_pCanvas;
    SkPaint* m_pPaint;
    std::stack<SkPaint>* m_pPaintStack;
    SkPath* m_pPath;
    bool m_bPushPaint;
};

}

#endif